package com.wn.message.controller;


import com.wn.common.entity.MyRsp;
import com.wn.common.entity.PhoneMsgEntity;
import com.wn.message.service.PhoneMsgService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsProject: cloud_base_4
 * @BelongsPackage: com.wn.message.controller
 * @Author: 廖刚
 * @CreateTime: 2020-06-03 23:10
 * @Description:
 */
@RestController
@Api(value = "手机消息模块接口",description = "这是一个手机消息模块的接口文档")
public class PhoneMsgController {

    @Autowired
    private PhoneMsgService phoneMsgService;


    @Async
    @ApiOperation("根据手机号码去发送短信")
    @PostMapping("/sendPhoneMsg")
    public MyRsp sendPhoneMsg(@RequestBody PhoneMsgEntity phoneMsgEntity){
        System.out.println(phoneMsgEntity);
        phoneMsgService.sendPhoneMsg(phoneMsgEntity.getPhoneNum());
        return MyRsp.success("发送成功");
    }
}
